package com.sm.scorpio.ui.activity.chat;

import android.os.Parcel;
import android.os.Parcelable;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.sm.imlibrary.model.Message;

/**
 * created by zhud on 2019/7/18
 */
public class ChatBean implements MultiItemEntity, Parcelable {
    public static final int TYPE_LEFT_MESSAGE = 1;
    public static final int TYPE_RIGHT_MESSAGE = 2;

    public ChatBean() {
    }

    public ChatBean(Message message) {
        this.message = message;
    }

    private Message message;

    protected ChatBean(Parcel in) {
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<ChatBean> CREATOR = new Creator<ChatBean>() {
        @Override
        public ChatBean createFromParcel(Parcel in) {
            return new ChatBean(in);
        }

        @Override
        public ChatBean[] newArray(int size) {
            return new ChatBean[size];
        }
    };

    @Override
    public int getItemType() {
        return message.isSelf() ? TYPE_RIGHT_MESSAGE : TYPE_LEFT_MESSAGE;
    }
}
